<!DOCTYPE html>
<html>
<head>
    <title>Select Event Example</title>
    <script type="text/javascript" src="EventUtil.js"></script>
</head>
<body>
    <form method="post" action="javascript:alert('Form submitted!')" id="myForm">        
        <div>
            <label for="comments">Any comments?</label><br>
            <textarea rows="10" cols="50" id="comments" name="comments">Select some of this text.</textarea>
        </div>
        <input type="button" value="Select Text" id="select-btn">
        <input type="submit" value="Submit Form" id="submit-btn">
    </form>     
    <script type="text/javascript">
        EventUtil.addHandler(document.getElementById("comments"), "select", function(event){
            alert("Text is selected!");
        });               
        EventUtil.addHandler(document.getElementById("select-btn"), "click", function(event){
            document.getElementById("comments").select();
        });               

    </script>
</body>
</html>
